import {createRouter, createWebHistory} from 'vue-router'

const Index = () => import('@/components/Index');

/* 人事信息管理部分 */
const Personnel = () => import('@/views/personnel/Personnel');
const Department = () => import('@/views/personnel/department/Department');
const Employee = () => import('@/views/personnel/employee/Employee');
const Management = () => import('@/views/personnel/management/Management');
const BecomeFullMember = () => import('@/views/personnel/management/managementChildren/BecomeFullMember');
const Induction = () => import('@/views/personnel/management/managementChildren/Induction');
const Quit = () => import('@/views/personnel/management/managementChildren/Quit');
const Transfer = () => import('@/views/personnel/transfer/Transfer');

/* 文档管理 */
const MyFile = () => import('@/views/document/myFile/MyFile')
const PublicFile = () => import('@/views/document/publicFile/PublicFile')
const ViewFile = () => import('@/views/document/viewFile/ViewFile')
const Document = () => import('@/views/document/Document')
const UploadFile= () => import('@/views/document/uploadFile/UploadFile')

/* 电子邮件 */
const Email = () => import('@/views/email/Email')
const CheckMail = () => import('@/views/email/checkMail/CheckMail')
const Draft = () => import('@/views/email/draft/Draft')
const Dustbin = () => import('@/views/email/dustbin/Dustbin')
const ReceiveMail = () => import('@/views/email/receiveMail/ReceiveMail')
const SendMail = () => import('@/views/email/sendMail/SendMail')

/* 通知公告 */
const Notification = () => import('@/views/notification/Notification')
const InformOverView = () => import('@/views/notification/informOverView/InformOverView')
const ManageInform = () => import('@/views/notification/manageInform/ManageInform')
const ModifyInform = () => import('@/views/notification/modifyInform/ModifyInform')
const ReleaseInform = () => import('@/views/notification/releaseInform/ReleaseInform')
const ViewInform = () => import('@/views/notification/viewInform/ViewInform')

/* 考勤 */
const Attendance = () => import('@/views/attendance/Attendance');
const AttendanceManagement = () => import('@/views/attendance/attendanceManagement/AttendanceManagement');
const PersonalAttendance = () => import('@/views/attendance/personalAttendance/PersonalAttendance');

/* 系统说明 */
const Brief = () => import('@/views/oa/Brief');
const Team = () => import('@/views/oa/Team');
const Thank = () => import('@/views/oa/Thank');

/* 系统管理 */
const Information = () => import('@/views/system/Information');
const Password = () => import('@/views/system/Password');
const System = () => import('@/views/system/System');

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Index,
    redirect: '/brief',
    children: [
      {
        path: '/brief',
        component: Brief
      },
      {
        path: '/team',
        component: Team
      },
      {
        path: '/thank',
        component: Thank
      },
      {
        path: '/personnel',
        component: Personnel,
        // redirect: '/personnel/employee',
        children: [
          {
            path: 'department',
            component: Department
          },
          {
            path: 'employee',
            component: Employee
          },
          {
            path: 'management',
            component: Management,
            redirect: '/personnel/management/induction',
            children: [
              {
                path: 'induction',
                component: Induction
              },
              {
                path: 'becomefullmember',
                component: BecomeFullMember
              },
              {
                path: 'quit',
                component: Quit
              }
            ]
          },
          {
            path: 'transfer',
            component: Transfer
          }
        ]
      },
      {
        path: '/notification',
        component: Notification,
        children: [
          {
            path: 'informoverview',
            component: InformOverView
          },
          {
            path: 'manageinform',
            component: ManageInform
          },
          {
            path: 'modifyinform',
            component: ModifyInform
          },
          {
            path: 'releaseinform',
            component: ReleaseInform
          },
          {
            path: 'viewinform',
            component: ViewInform
          }
        ]
      },
      {
        path: '/email',
        component: Email,
        children: [
          {
            path: 'checkmail',
            component: CheckMail
          },
          {
            path: 'draft',
            component: Draft
          },
          {
            path: 'dustbin',
            component: Dustbin
          },
          {
            path: 'receivemail',
            component: ReceiveMail
          },
          {
            path: 'sendmail',
            component: SendMail
          }
        ]
      },
      {
        path: '/document',
        component: Document,
        children: [
          {
            path: 'myfile',
            component: MyFile
          },
          {
            path: 'publicfile',
            component: PublicFile
          },
          {
            path: 'viewfile',
            component: ViewFile
          },
          {
            path: 'uploadfile',
            component: UploadFile
          }
        ]
      },
      {
        path: '/attendance',
        component: Attendance,
        children: [
          {
            path: 'personalattendance',
            component: PersonalAttendance
          },
          {
            path: 'attendancemanagement',
            component: AttendanceManagement
          }
        ]
      },
      {
        path: '/system',
        component: System,
        children: [
          {
            path: 'information',
            component: Information
          },
          {
            path: 'password',
            component: Password
          }
        ]
      },
    ]
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
});

export default router
